<?php

class FormSpinner extends FormControl {
	
	public static $property = array(
		'wbtype',
		'name',
		'caption',
		'x',
		'y',
		'width',
		'height',
		'disabled',
		'group',
		'visible'
	);	
		
	public function __construct() { 
		parent::__construct(array(
			'wbtype' => 'Spinner',
			'x' => 0,
			'y' => 0,
			'width' => 20,
			'height' => 30
		));
	}

	/**
	 * 컨트롤 그리기 
	 * 
	 * @param WBGraphics $graphics
	 */
	public function displayControl(WBGraphics $g) {

		$xstart = $this->getOption('x');
		$ystart = $this->getOption('y');
		$width = $this->getOption('width');
		$height = $this->getOption('height');		

		$btnHeight = $height / 2 ;
		
		$this->displayButton($g, " ", $xstart, $ystart, $width, $btnHeight);
		$this->displayButton($g, " ", $xstart, $ystart + $btnHeight, $width, $btnHeight);
		
		if ($width > 7 && $height > 11) { 
			$image1 = WBImage::loadFile(RESOURCE_HOME . "symb_uparrow.bmp"); 
			$image2 = WBImage::loadFile(RESOURCE_HOME . "symb_dnarrow.bmp"); 
						
			$g->image($image1->instance, $xstart + ($width - 7)/2, $ystart + $btnHeight/2 - 3 , 7, 4, GREEN);
			$g->image($image2->instance, $xstart + ($width - 7)/2, $ystart + $height - $btnHeight + $btnHeight/2 - 2 , 7, 4, GREEN);

			$image1->destroy();
			$image2->destroy();
		}

	}
	
	public function getProperty() { 
		return self::$property;
	}	
}


?>